#include "Enemy.h"
#include <SDL.h>

# define M_PI           3.14159265358979323846
int numberOfTicks = 0, x;


Enemy::Enemy(const LoadedParams* Params, int animationSpeed, int numFrames, int shield, int moveBoundaries, int speed) : AnimatedGraphic(Params, animationSpeed, numFrames), 
	mShield(shield), mMoveBoundaries(moveBoundaries), mSpeed(speed)
{
	mStartX = Params->getX();
}

void Enemy::Draw()
{
	AnimatedGraphic::Draw();
}

void Enemy::Update()
{
	++numberOfTicks;
	x = (mMoveBoundaries * (sin(numberOfTicks *0.5* M_PI / 60))) + mStartX;
	position.setX(x);
	velocity.setY(mSpeed);
	currentFrame = int(((SDL_GetTicks() / 100) % 6));
	AnimatedGraphic::Update();
}

void Enemy::Shutdown()
{
	AnimatedGraphic::Shutdown();
}
